<?php
namespace app\api\controller;

use app\common\server\Weixinpublic;
use app\api\controller\Crawler;
class Wxlogin{
    public function index(){
        $info=[
            [
                'account' => '377837240@qq.com',
                'password' => 'ld19941029',
                'key' => "wx1",
            ],
            [
                'account' => '1596114905@qq.com',
                'password' => 'ld19941029',
                'key' => "wx2",
            ],
            [
                'account' => '18142011601@163.com',
                'password' => 'dashu168',
                'key' => "wx3",
            ]
        ];

        // $info = [
        //        'account' => 'elaufy',
        //        'password' => 'Hzh15658872082',
        //        'key' => "wx4",
        // ];
        foreach ($info as $k => $v) {
            $weixin = new Weixinpublic($v);
            $token = $weixin->_init();

            if (!$token) {
                die("NOT TOKEN!");
            }else {
                echo $v['key'].'登录成功';
            }
            sleep(5);
        }
    }


    public function crawl(){
        $public_name = '程序员每日分享';

        $wxArr =['wx1','wx2','wx3'];
        foreach ($wxArr as $v){
            $crawler = new Wcrawler($public_name,$v);
            $crawler->index();

            sleep(2);
        }

    }


    public function everyDay(){
        $public_name = '程序员每日分享';
        $crawler = new Wpspider($public_name,'wx1');
        $crawler->index();
    }

}